# Maintainer: Krassy Boykinov <kboykinov@teamcentrixx.com>
pkgname=onevpl
pkgver=2023.3.1
pkgrel=2
pkgdesc="oneAPI Video Processing Library"
url="https://github.com/oneapi-src/oneVPL"
arch="x86_64" # only x86_64 supported
license="MIT"
makedepends="cmake samurai"
subpackages="$pkgname-doc $pkgname-libs $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/oneapi-src/oneVPL/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/libvpl-$pkgver"

build() {
	CXXFLAGS="$CXXFLAGS -flto=auto" \
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DVPL_INSTALL_ENVDIR=/usr/share/oneVPL/env \
		-DVPL_INSTALL_LICENSEDIR=/usr/share/doc/oneVPL \
		-DVPL_INSTALL_MODFILEDIR=/usr/share/oneVPL/modulefiles \
		-DBUILD_PREVIEW=OFF \
		-DBUILD_EXAMPLES=OFF \
		-DBUILD_TOOLS=ON \
		-DINSTALL_EXAMPLE_CODE=OFF \
		-DBUILD_TESTS="$(want_check && echo ON || echo OFF)"
	cmake --build build
}

check() {
	ctest --output-on-failure --test-dir build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

dev() {
	default_dev

	amove usr/share
}

sha512sums="
a555a7c589e22fdf6c52a33ef524864f26d7d21548b03c2c6199cfab8e5ab565f84567348bb3fe50392354677e020429712351e8595c2e610d0e0c403851b8dc  onevpl-2023.3.1.tar.gz
"
